package com.bzyd.derby.vo;

import lombok.Data;

import java.io.Serializable;

@Data
public class SysResult implements Serializable {
    private static final long serialVersionUID = 2080943344863436345L;

    private Integer code;
    private String msg;
    private Object data;

    private SysResult(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static SysResult ok() {
        return new SysResult(200, "success", null);
    }

    public static SysResult ok(Object data) {
        return new SysResult(200, "success", data);
    }

    public static SysResult fail() {
        return new SysResult(201, "fail", null);
    }

    public static SysResult fail(String msg) {
        return new SysResult(201, msg, null);
    }

    public static SysResult fail(Integer code, String msg) {
        return new SysResult(code, msg, null);
    }
}
